﻿@using CodeCamp.Models.Sessions
@using CodeCamp.Models.Shared
@using CodeCamp.Infrastructure.Extensions
@model SessionsListViewModel
@{
    Layout = "~/Views/Shared/_LayoutWideSimple.cshtml";
    ViewBag.Title = "";
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = @Html.Encode(@Model.EventDisplayName + " | Unscheduled Sessions");
    }
    else
    {
        ViewBag.Title = "Code Camp | Unscheduled Sessions";
    }
}
@section headaddon {
<style>
    a.session-title
    {
        font-size: 11pt;
    }
    #content
    {
        width: 900px;
    }
    #sessionTable
    {
        border-collapse: collapse;
        text-align:left;
    }
</style>
}

<h1 class="title">Unscheduled Sessions at @Model.EventDisplayName</h1>
<h3>Non-Public Page</h3>
<h3>@Model.EventStartDate.ToString("MMMM yyyy")</h3>
<h4>@Html.ActionLink("Unscheduled Sessions - Sortable List", "UnscheduledSessions", new { eventName=Model.EventShortName})</h4>
<h4>@Html.ActionLink("Session Grid", "SessionGrid", "Schedule", new { eventName=Model.EventShortName}, null)</h4>

<table id="sessionTable">
    <tr>
        <td></td><th>Status</th><th>Created (UTC)</th><th>Title</th><th>Presenters</th><th>Tags</th>
    </tr>
@foreach (SessionViewModel session in @Model.Sessions)
{
    <tr>
        <td>
        @if (User.IsInRole(CCRoles.RoleNames.BigCheeze) || User.IsInRole(CCRoles.RoleNames.EventContentEditor))
        {
            @Html.ActionLink("edit", "Edit", new { id = session.Id })
        }
        </td>
        <td>@session.Status.ToString()</td>
        <td style="white-space:nowrap;">@string.Format("{0:MM/dd/yyyy HH:mm UTC}", session.CreatedUTC)</td>
        <td>
            @Html.Partial("PartialViews/SessionTitle", new SessionTitle { SessionId = session.Id, Title = session.Title })
        </td>
        <td>@{
            var firstPresenter = true;
            foreach(var presenter in session.SessionPresenters.Presenters)
            {
                if (!firstPresenter) {<text>, </text>}
                else { firstPresenter = false; }
                @Html.ActionLink(presenter.Name, "Details", "Presenters", new { id = presenter.Id }, null)
            }}
        </td>
        <td>
    @{
        bool firstTag = true;
        foreach (var tag in session.Tags.Tags)
        {
            if (!firstTag)
            { <text>, </text> }
            firstTag = false;
            @Html.ActionLink( tag.Name, "Tag", new { id = tag.TagId } )
        }
    }
        </td>
    </tr>
}
</table>
